package com.example.dao;

import com.example.domain.RewardPunish;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author luo
 */
@Mapper
public interface RewardPunishDao {
    /**
     * 查询所有的奖惩
     * @return
     */
    @Select("select * from rewardpunish")
    public List<RewardPunish> selectReward();

    /**
     * 按id查询奖惩
     * @param id
     * @return
     */
    @Select("select * from rewardpunish where id=#{id};")
    public RewardPunish selectRewardById(Integer id);
    /**
     * 模糊查询
     * @param rewardPunish
     * @return
     */
//    @Select("select * from rewardpunish where name like #{name};")

    public List<RewardPunish> selectRewardPunishByName(RewardPunish rewardPunish);

    /**
     * 添加奖惩信息
     * @param rewardPunish
     * @return
     */
    @Insert("insert into rewardpunish (name,  content, wages,category) values (#{name},#{content},#{wages},#{category});")
    public int addRewardPunish(RewardPunish rewardPunish);

    /**
     * 更新奖惩信息
     *
     * @param rewardPunish
     * @return
     */
    @Update("update rewardpunish set name=#{name},content=#{content},wages=#{wages},category=#{category} where id=#{id};")
    public int updateRewardPunish(RewardPunish rewardPunish);

    /**
     * 按id删除
     * @param id
     * @return
     */
    @Delete("delete from rewardpunish where id=#{id};")
    public int deleteRewardPunish(Integer id);
}
